import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
    home: Scaffold(
      appBar: AppBar(title: const Text('这是按钮页面')),
      body: const Column(
        children: [
          MyBtn(),
          MyText(),
        ],
      ),
    ),
  ));
}

class MyBtn extends StatelessWidget {
  const MyBtn({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      alignment: Alignment.center,
      width: 200,
      height: 50,
      // padding: const EdgeInsets.all(10),
      // color: Colors.white, 有decoration属性的不能加color属性
      // transform: Matrix4.translationValues(10, 0, 0),
      // 旋转
      // transform: Matrix4.skewY(20),
      // transform: Matrix4.rotationZ(0.2),
      decoration: BoxDecoration(
        color: Colors.green,
        borderRadius: BorderRadius.circular(8),
      ),
      child: const Text(
        '按钮',
        style: TextStyle(color: Colors.white, fontSize: 20),
      ),
    );
  }
}

class MyText extends StatelessWidget {
  const MyText({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      // alignment: Alignment.center,
      width: 400,
      height: 100,
      margin: const EdgeInsets.fromLTRB(10, 20, 30, 40),
      decoration: const BoxDecoration(color: Colors.amber),
      child: const Text(
        '你好，我是flutter2dx对对对对对对多多哒哒哒哒哒哒多多多多多多多多多多多多多多多多多',
        // 可以左右居中
        textAlign: TextAlign.center,
        // 最多显示一行
        // maxLines: 1,
        // 超出显示省略号
        overflow: TextOverflow.ellipsis,
        style: TextStyle(
          fontSize: 30,
          fontStyle: FontStyle.italic,
          letterSpacing: 4.0,
          // 设置穿过的线
          decoration: TextDecoration.overline,
          // 设置线的颜色
          decorationColor: Colors.white,
        ),
      ),
    );
  }
}
